<template>
  {{ set }} <br />

  总计个数： {{ setCount }} <br />

  <button @click="addItem">添加</button>
  <button @click="deleteItem">删除</button>
  <button @click="updateItem">修改</button>
</template>

<script setup lang="ts">
import { ref } from "vue";

let set = new Set();
set.add(1);
set.add(false);
set.add("Hello world!");

let setCount = ref(set.size);

//--======================

let addItem = () => {
  set.add("Dell");
  setCount.value = set.size;
  console.log(set);
};

let deleteItem = () => {
  set.delete("Dell");
  setCount.value = set.size;
};

let updateItem = () => {
  // Set 无法直接修改值， 只能先删除， 再添加
};
</script>

<style scoped>
button {
  margin: 0 10px;
}
</style>